package com.yanchangapp.ui.activity._n_manage;

import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.CalendarLayout;
import com.haibin.calendarview.CalendarView;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.yanchangapp.R;
import com.yanchangapp.widget.calendar.MySmartRefreshLayout;
import com.yanchangapp.widget.calendar.MySwipeRefreshLayout;
import com.zxl.baselib.util.ui.UIUtils;

/**
 * 日历范围选择....
 */
public class CalendarRangeActivity extends AppCompatActivity implements CalendarView.OnCalendarRangeSelectListener {
    CalendarView mCalendarView;
    CalendarLayout calendarLayout;
    MySwipeRefreshLayout swipe;
    private View frameLayout;
    public static void show(Activity activity){
        Intent intent = new Intent(activity,CalendarRangeActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calendar_range);
        mCalendarView = findViewById(R.id.calendarView);
        calendarLayout = findViewById(R.id.calendarLayout);
        swipe = findViewById(R.id.swipe);
        frameLayout = findViewById(R.id.frameLayout);
        mCalendarView.setOnCalendarRangeSelectListener(this);
        swipe.setCalendarLayout(calendarLayout);
        swipe.setContentView(frameLayout);

        swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                swipe.setRefreshing(true);
                UIUtils.postTaskDelay(new Runnable() {
                    @Override
                    public void run() {
                        swipe.setRefreshing(false);
                    }
                },3000);
            }
        });
    }

    @Override
    public void onCalendarSelectOutOfRange(Calendar calendar) {

    }

    @Override
    public void onSelectOutOfRange(Calendar calendar, boolean isOutOfMinRange) {

    }

    @Override
    public void onCalendarRangeSelect(Calendar calendar, boolean isEnd) {

    }
}
